<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('K号查询列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <form id="formId">
                <input type="hidden" name="kkid" th:value="${kkid}"/>
                <input type="hidden" name="appId" th:value="${appId}"/>
            </form>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('user:kknumber:edit')}]];
        var removeFlag = [[${@permission.hasPermi('user:kknumber:remove')}]];
        var appIdDatas = [[${@dict.getType('storage_app_type')}]];
        var prefix = ctx + "user/kknumber";
        var privilegePrefix = ctx + "user/userprivilege";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "K号查询",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'ID',
                    visible: false
                },
                {
                    field : 'no', 
                    title : 'K号'
                },
                {
                    field : 'appId', 
                    title : '应用ID',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(appIdDatas, value);
                    }
                },
                {
                    field : 'kkid', 
                    title : 'KKID'
                },
                {
                    field : 'nickname',
                    title : '昵称'
                },
                {
                    field : 'protrait',
                    title : '头像',
                    formatter: function(value, row, index) {
                    	if(value){
                    		return $.table.imageView(value);
                        }
                    	return ''
                	}
                },
                {
                    field : 'thirdType',
                    title : '登陆类型'
                },
                {
                    field : 'phone',
                    title : '手机'
                },
                {
                    field : 'regTime',
                    title : '注册时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="privilegeList(\'' + row.kkid + '\', \'' + row.appId + '\')"><i class="fa fa-edit"></i>用户特权列表</a> ');
                        //actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function privilegeList(kkid, appId) {
		    var url = privilegePrefix + "/" + kkid + "/" + appId;
		    //$.modal.open("用户特权列表", url);
		    $.modal.open("用户特权列表", url, "", "", function(index, layero){
               layer.close(index);
		    });
		}

    </script>
</body>
</html>